package thread;

public class ThreadDemo9 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() -> {
           for(int i = 0; i < 5; i++){
               System.out.println("hello run");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
        });
        t.start();

        //让线程等待 可以理解为我在main线程中 需要等待t现场结束的时候才继续进行 main线程
        t.join();

        System.out.println("haha");
        
    }
}
